package net.seninp.fdata.data;

import javax.xml.datatype.XMLGregorianCalendar;
import org.hackystat.utilities.tstamp.Tstamp;

/**
 * Implements a single point of measurement.
 *
 * @author psenin
 *
 */
public class Measurement {

  private String fisheryId;
  private XMLGregorianCalendar tstamp;
  private String gr;
  private double latd;
  private double lond;
  private String astrat;
  private double days;
  private double hhooks;
  private double yft_n;
  private double yft_c;

  /**
   * Constructor.
   *
   * @param str A single comma-separated string to parse.
   */
  public Measurement(String str) {
    str = str.replaceAll("\"", "");
    String[] split = str.split("\\,");

    this.fisheryId = split[0].substring(0);

    this.tstamp = Tstamp.makeTimestamp(0L);
    this.tstamp.setYear(Integer.valueOf(split[1]));
    this.tstamp.setMonth(Integer.valueOf(split[2]));

    this.gr = split[3].substring(0);
    this.latd = Double.valueOf(split[4]).doubleValue();
    this.lond = Double.valueOf(split[5]).doubleValue();
    this.astrat = split[6].substring(0);
    this.days = Double.valueOf(split[7]).doubleValue();
    this.hhooks = Double.valueOf(split[8]).doubleValue();
    this.yft_n = Double.valueOf(split[9]).doubleValue();
    this.yft_c = Double.valueOf(split[10]).doubleValue();
  }

  /**
   * @return the fisheryId
   */
  public String getFisheryId() {
    return fisheryId;
  }

  /**
   * @param fisheryId the fisheryId to set
   */
  public void setFisheryId(String fisheryId) {
    this.fisheryId = fisheryId;
  }

  /**
   * @return the tstamp
   */
  public XMLGregorianCalendar getTstamp() {
    return tstamp;
  }

  /**
   * @param tstamp the tstamp to set
   */
  public void setTstamp(XMLGregorianCalendar tstamp) {
    this.tstamp = tstamp;
  }

  /**
   * @return the gr
   */
  public String getGr() {
    return gr;
  }

  /**
   * @param gr the gr to set
   */
  public void setGr(String gr) {
    this.gr = gr;
  }

  /**
   * @return the latd
   */
  public double getLatd() {
    return latd;
  }

  /**
   * @param latd the latd to set
   */
  public void setLatd(double latd) {
    this.latd = latd;
  }

  /**
   * @return the lond
   */
  public double getLond() {
    return lond;
  }

  /**
   * @param lond the lond to set
   */
  public void setLond(double lond) {
    this.lond = lond;
  }

  /**
   * @return the astrat
   */
  public String getAstrat() {
    return astrat;
  }

  /**
   * @param astrat the astrat to set
   */
  public void setAstrat(String astrat) {
    this.astrat = astrat;
  }

  /**
   * @return the days
   */
  public double getDays() {
    return days;
  }

  /**
   * @param days the days to set
   */
  public void setDays(double days) {
    this.days = days;
  }

  /**
   * @return the hhooks
   */
  public double getHhooks() {
    return hhooks;
  }

  /**
   * @param hhooks the hhooks to set
   */
  public void setHhooks(double hhooks) {
    this.hhooks = hhooks;
  }

  /**
   * @return the yft_n
   */
  public double getYft_n() {
    return yft_n;
  }

  /**
   * @param yftN the yft_n to set
   */
  public void setYft_n(double yftN) {
    yft_n = yftN;
  }

  /**
   * @return the yft_c
   */
  public double getYft_c() {
    return yft_c;
  }

  /**
   * @param yftC the yft_c to set
   */
  public void setYft_c(double yftC) {
    yft_c = yftC;
  }

  public Integer getYear() {
    return this.tstamp.getYear();
  }

  public Integer getMonth() {
    return this.tstamp.getMonth();
  }

}
